module.exports = (sql, params = null) => {
    const mysql = require('mysql')
    const conn = mysql.createConnection({
        host: 'localhost',
        user: 'root',
        password: 'root',
        database: 'bigevent'
            //还要创建数据库
    })
    conn.connect()
    return new Promise((reslove, reject) => {
        conn.query(sql, params, (err, result) => {
            err ? reject(err) : reslove(result)
        })
        conn.send()
    })
    conn.catch(err => {
        console.log(err);

    })
}